/*
 * @lc app=leetcode.cn id=2224 lang=typescript
 *
 * [2224] 转化时间需要的最少操作数
 */

// @lc code=start
function convertTime(current: string, correct: string): number {
    const strToNum = (current: string) => {
        const [hour, min] = current.split(":");
        return [parseInt(hour), parseInt(min)];
    };
    const [a_h, a_m] = strToNum(current);
    const [b_h, b_m] = strToNum(correct);
    let h_p = b_h - a_h;
    let last = b_m - a_m;
    if (last < 0) {
        last += 60;
        h_p--;
    }
    const c_15 = Math.floor(last / 15);
    last = last % 15;
    const c_5 = Math.floor(last / 5);
    last = last % 5;
    const lessThan60 = c_15 + c_5 + last;
    return h_p + lessThan60;
}
// @lc code=end
